<?php
require_once "db.php";
require_once "util.php";
require_once "header_objects.php";

get_database_connection();

$title = $_REQUEST["title"];

// Inserting
$sql = "INSERT INTO objects (title) VALUES ('$title');";
$res = mysql_query($sql);

$object_id = mysql_insert_id();
$user_id = $_COOKIE["user_id"];

$sql = "INSERT INTO objects_users (object_id, user_id) VALUES ('$object_id', '$user_id');";
$res = mysql_query($sql);

set_flash("Objeto adicionado com exito.");
ddd_redirect("index.objects.php");
?>



